<div class="left">
	<usr:itsMine target="${comicInstance.createdBy.id}">
		<g:link class="edit" url="[controller:'comic', action:'editProfile', id:comicInstance?.id]">${message(code: 'default.button.edit.profile')}</g:link>
		<g:link class="edit" url="[controller:'comic', action:'editFile', id:comicInstance?.id]">${message(code: 'default.button.edit.file')}</g:link>

		<usr:isAdmin>
			<g:if test="${comicInstance.disabled}">
				<g:form controller="comic" action="enable">
	    			<g:hiddenField name="id" value="${comicInstance?.id}" />
	    			<g:submitButton class="itemButton disable" name="enable" value="${message(code:'default.button.enable')}" />
	        	</g:form>    		
			</g:if>
	       	<g:else>
		       	<g:form controller="comic" action="disable">
	    			<g:hiddenField name="id" value="${comicInstance?.id}" />
	    			<g:submitButton class="itemButton disable" name="disable" value="${message(code:'default.button.disable')}" />
	        	</g:form>
        	</g:else>
		</usr:isAdmin>
	</usr:itsMine>
				
		<usr:itsNotMine target="${comicInstance.createdBy.id}">
			<g:link url="[controller:'user', action:'addToFavorites', id:comicInstance?.id]"><g:message code="default.button.add.favorite.comic"/></g:link>
		</usr:itsNotMine>
		<usr:itsMine target="${comicInstance.createdBy.id}">
			<g:form name="addPageToComic" url="[action:'create',controller:'page',id:comicInstance?.id]">
				<g:submitButton class="itemButton create" name="create" value="${message(code:'default.button.add.page')}" />
			</g:form>
		</usr:itsMine>

	<g:if test="${comicInstance?.commentable}">
		<g:remoteLink controller="comic" action="comments" params="['commentToId':comicInstance.id, 'commentToName':'comic']" update="commentWrapper" onComplete="showComment(); setEnviroment();">
			<g:message code="default.button.comment.list"/>:(${comicInstance.comments?.size()})
		</g:remoteLink>
	</g:if>

	<g:if test="${comicInstance?.page}">
		<g:form name="listPages" url="[controller:'page', action:'list',params:['fromId':comicInstance?.id]]">
			<g:submitButton class="itemButton list" name="list" value="${message(code:'default.button.list.pages')}" />
		</g:form>
		
		<input type="button" class="itemButton show js_run" name="show" value="${message(code:'default.button.play')}" />
		<div class="hidden js_play">
			<g:set var="orderedPages" value="${comicInstance?.page.sort{it.numberPage}}" />
			<g:each in="${orderedPages}" var="pageInstance">
				<a class="lightbox" href="${resource(file:pageInstance?.pathFile)}" rel="lightbox[${comicInstance.id}]" title="${pageInstance?.title}"></a>
			</g:each>	
		</div>
	</g:if>
	<usr:isUser>
		<g:form controller="comic" action="moderationRequest">
   			<g:hiddenField name="id" value="${comicInstance?.id}" />
   			<g:submitButton class="itemButton" name="moderationRequest" value="${message(code:'default.button.moderation.request')}" />
       	</g:form>
	</usr:isUser>
	
	<g:if test="${comicInstance.moderationRequest}">
		<usr:isAdmin>
			<g:form controller="comic" action="moderate">
	   			<g:hiddenField name="id" value="${comicInstance?.id}" />
	   			<g:submitButton class="itemButton disable" name="enable" value="${message(code:'default.button.moderate')}" />
	       	</g:form>
		</usr:isAdmin>
	</g:if>
	
	
	<g:if test="${comicInstance?.page}">
		<input type="button" class="itemButton show js_run_best" name="show" value="${message(code:'default.button.best')}" />
			<div class="hidden js_play_best">
				<g:each in="${bestPages}" var="pageInstance">
					<a class="lightbox" href="${resource(file:pageInstance?.pathFile)}" rel="lightbox[best]" title="${pageInstance?.title}"></a>
				</g:each>	
			</div>
	</g:if>
		
</div>

<div class="right">
	<usr:itsMine target="${comicInstance.createdBy.id}">
		<g:form>
		 	<g:hiddenField name="id" value="${comicInstance?.id}" />
			<g:actionSubmit class="delete" action="Delete" value="${message(code:'default.button.delete')}" onclick="return confirm('${message(code:'default.button.delete.confirm.message')}');" />
		</g:form>
	</usr:itsMine>
	
	<g:form controller="comic" >
		<g:actionSubmit class="back" action="list" value="${message(code:'default.button.back')}" />
	</g:form>
</div>